<script setup>
const features = [
	{
		id: 1,
		title: '推流测试',
		description: '实时视频推流功能测试',
		icon: '📹',
		url: '/pages/live-pusher/settings',
		color: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)'
	},
	{
		id: 2,
		title: '拉流测试',
		description: '实时视频拉流播放测试',
		icon: '📺',
		url: '/pages/live-player/live-player',
		color: 'linear-gradient(135deg, #f093fb 0%, #f5576c 100%)'
	},
	{
		id: 3,
		title: '直播回放',
		description: '历史直播内容回放功能',
		icon: '🎬',
		url: '/pages/playback/playback',
		color: 'linear-gradient(135deg, #4facfe 0%, #00f2fe 100%)'
	}
]

const toPage = (url) => {
	uni.navigateTo({
		url
	})
}
</script>

<template>
	<view class="container">
		<!-- 顶部标题区域 -->
		<view class="header">
			<view class="header-content">
				<text class="app-title">uni直播测试</text>
				<text class="app-subtitle">Live Streaming Test Platform</text>
			</view>
			<view class="header-decoration"></view>
		</view>

		<!-- 功能卡片网格 -->
		<view class="features-grid">
			<view 
				v-for="feature in features" 
				:key="feature.id"
				class="feature-card"
				:style="{ background: feature.color }"
				@click="() => toPage(feature.url)"
			>
				<view class="card-content">
					<view class="card-icon">
						<text class="icon-emoji">{{ feature.icon }}</text>
					</view>
					<view class="card-text">
						<text class="card-title">{{ feature.title }}</text>
						<text class="card-description">{{ feature.description }}</text>
					</view>
					<view class="card-arrow">
						<uni-icons type="arrowright" size="20" color="#fff"></uni-icons>
					</view>
				</view>
			</view>
		</view>

		<!-- 底部信息 -->
		<view class="footer">
			<view class="footer-content">
				<text class="footer-text">基于 uni-app 构建</text>
				<view class="footer-dots">
					<view class="dot"></view>
					<view class="dot"></view>
					<view class="dot"></view>
				</view>
			</view>
		</view>
	</view>
</template>

<style lang="less" scoped>
	.container {
		min-height: 100vh;
		background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
		padding: 0;
		position: relative;
		overflow: hidden;
	}

	.header {
		position: relative;
		padding: 60px 20px 40px;
		text-align: center;
		
		.header-content {
			position: relative;
			z-index: 2;
		}
		
		.app-title {
			display: block;
			font-size: 32px;
			font-weight: bold;
			color: #fff;
			margin-bottom: 8px;
			text-shadow: 0 2px 4px rgba(0,0,0,0.3);
		}
		
		.app-subtitle {
			display: block;
			font-size: 14px;
			color: rgba(255,255,255,0.8);
			letter-spacing: 1px;
		}
		
		.header-decoration {
			position: absolute;
			top: 0;
			left: 50%;
			transform: translateX(-50%);
			width: 60px;
			height: 4px;
			background: rgba(255,255,255,0.5);
			border-radius: 2px;
		}
	}

	.features-grid {
		padding: 0 20px;
		display: flex;
		flex-direction: column;
		gap: 16px;
	}

	.feature-card {
		border-radius: 20px;
		overflow: hidden;
		box-shadow: 0 8px 32px rgba(0,0,0,0.1);
		transition: all 0.3s ease;
		position: relative;
		
		&:active {
			transform: translateY(2px);
			box-shadow: 0 4px 16px rgba(0,0,0,0.2);
		}
		
		.card-content {
			padding: 24px;
			display: flex;
			align-items: center;
			position: relative;
			
			&::before {
				content: '';
				position: absolute;
				top: 0;
				left: 0;
				right: 0;
				bottom: 0;
				background: linear-gradient(45deg, transparent 0%, rgba(255,255,255,0.1) 50%, transparent 100%);
				pointer-events: none;
			}
		}
		
		.card-icon {
			width: 60px;
			height: 60px;
			border-radius: 16px;
			background: rgba(255,255,255,0.2);
			display: flex;
			align-items: center;
			justify-content: center;
			margin-right: 20px;
			backdrop-filter: blur(10px);
			
			.icon-emoji {
				font-size: 28px;
			}
		}
		
		.card-text {
			flex: 1;
		}
		
		.card-title {
			display: block;
			font-size: 20px;
			font-weight: 600;
			color: #fff;
			margin-bottom: 4px;
			text-shadow: 0 1px 2px rgba(0,0,0,0.2);
		}
		
		.card-description {
			display: block;
			font-size: 14px;
			color: rgba(255,255,255,0.9);
			line-height: 1.4;
		}
		
		.card-arrow {
			width: 40px;
			height: 40px;
			border-radius: 12px;
			background: rgba(255,255,255,0.2);
			display: flex;
			align-items: center;
			justify-content: center;
			backdrop-filter: blur(10px);
		}
	}

	.footer {
		margin-top: 40px;
		padding: 40px 20px;
		text-align: center;
		
		.footer-content {
			display: flex;
			flex-direction: column;
			align-items: center;
			gap: 16px;
		}
		
		.footer-text {
			font-size: 14px;
			color: rgba(255,255,255,0.7);
		}
		
		.footer-dots {
			display: flex;
			gap: 8px;
		}
		
		.dot {
			width: 8px;
			height: 8px;
			border-radius: 50%;
			background: rgba(255,255,255,0.4);
			animation: pulse 2s infinite;
			
			&:nth-child(2) {
				animation-delay: 0.5s;
			}
			
			&:nth-child(3) {
				animation-delay: 1s;
			}
		}
	}

	@keyframes pulse {
		0%, 100% {
			opacity: 0.4;
			transform: scale(1);
		}
		50% {
			opacity: 1;
			transform: scale(1.2);
		}
	}

	/* 响应式设计 */
	@media screen and (min-width: 750px) {
		.container {
			max-width: 750px;
			margin: 0 auto;
		}
		
		.features-grid {
			display: grid;
			grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
			gap: 20px;
		}
	}
</style>